#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//https://www.luogu.com.cn/problem/P10250
using namespace std;
typedef long long LL;
int main()
{
	LL a = 1, b = 1, c = 2, n;
	cin >> n;
	for (int i = 3; i <= n; ++i)
	{
		LL t = a + b + c;
		a = b;
		b = c;
		c = t;
	}

	if (n == 1)cout << 1 << endl;
	else cout << c << endl;

	return 0;
}